﻿''' <summary>
''' Diese Klasse ist die Basisklasse fuer Hauptmenue usw..
''' </summary>
''' <remarks></remarks>
Public MustInherit Class ObjektFormMenue
    Public KnoepfeLocker As New Mutex
    Public Knoepfe() As ObjektButton = {}
    Public Taskleiste As ObjektTaskleiste
    Public NUDS() As ObjektNumericUpDown = {}
    Public TUDS() As ObjektTimeUpDown = {}
    Public SUDSLocker As New Mutex
    Public SUDS() As ObjektStringUpDown = {}
    Public Box As ObjektBox
    Public Values As ObjektValueSchieber() = {}
    Public MultiValues As ObjektMultiValue() = {}
    Public CheckBoxenLocker As New Mutex
    Public CheckBoxen As ObjektCheckBox() = {}
    Public LabelsLocker As New Mutex
    Public Labels() As ObjektLabel = {}
    Public DropDownMenues As ObjektDropDownMenue() = {}
    Public Textboxen As ObjektTextbox() = {}
    Public Panels() As ObjektPanel = {}
    Public ToolTipCounter As Integer = 0
    Dim OldGamePoint As Point
    Public Function ToolTipCounterFrame() As Boolean
        If DataSettings.ToolTips Then
            If DidCursorMove() Then
                ToolTipCounter = 0
                Return False
            Else
                OldGamePoint = Hauptmenue.SpielfeldPunkt
                ToolTipCounter += 1
                If ToolTipCounter / DataSettings.SpielGeschwindigkeit >= 0.5 Then
                    ToolTipCounter -= 1 'In order not to exceed the RAM. Hey if you would long enough.
                    Return True
                Else
                    Return False
                End If
            End If
        Else
            ToolTipCounter = 0
            Return False
        End If
    End Function
    Public Overridable Function DidCursorMove() As Boolean
        If OldGamePoint <> Hauptmenue.SpielfeldPunkt Then
            OldGamePoint = Hauptmenue.SpielfeldPunkt
            Return True
        Else
            OldGamePoint = Hauptmenue.SpielfeldPunkt
            Return False
        End If
    End Function
    ''' <summary>
    ''' Shows the ToolTip for a Menu.
    ''' </summary>
    ''' <remarks></remarks>
    Public Overridable Sub ShowToolTip()
    End Sub
    Public Sub New(ByVal Knoepfe() As ObjektButton, ByVal Taskleiste As ObjektTaskleiste, ByVal NUDS() As ObjektNumericUpDown, ByVal Box As ObjektBox, ByVal Values() As ObjektValueSchieber, ByVal MultiValues() As ObjektMultiValue, ByVal Checkboxen As ObjektCheckBox())
        Me.Knoepfe = Knoepfe
        Me.Taskleiste = Taskleiste
        Me.NUDS = NUDS
        Me.Box = Box
        Me.CheckBoxen = Checkboxen
        Me.Values = Values
        Me.MultiValues = MultiValues
    End Sub
    Public Sub New()
        Me.Knoepfe = New ObjektButton() {}
        Taskleiste = Nothing
        Me.NUDS = New ObjektNumericUpDown() {}
        Box = Nothing
        Me.Values = New ObjektValueSchieber() {}
        Me.MultiValues = New ObjektMultiValue() {}
        Me.CheckBoxen = New ObjektCheckBox() {}
    End Sub
    Public MustOverride Sub IniMenue()
#Region "Events"
    Public MustOverride Sub KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
    Public MustOverride Sub KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
    Public MustOverride Sub MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
    Public MustOverride Sub MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
    Public MustOverride Sub MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
    Public MustOverride Sub MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
#End Region
#Region "Objekte ueberpruefen"
#Region "Mouse Up"
    Public Function checkMouseUPObjekte(ByVal X As Integer, ByVal Y As Integer) As String
        'Zuerst mal nachschauen ob wir nicht einen Focus haben.
        If Objekt2D.HasFocus Then
            For I = 0 To Objekt2D.Objekte.Length - 1
                If Objekt2D.Objekte(I).Focused Then
                    Return Objekt2D.Objekte(I).MouseUp(X, Y)
                End If
            Next
        End If
        For I = 0 To Panels.Length - 1
            Panels(I).MouseUp(X, Y)
        Next
        For I = 0 To Values.Length - 1
            Values(I).MouseUp(X, Y)
        Next
        For I = 0 To MultiValues.Length - 1
            MultiValues(I).MouseUp(X, Y)
        Next
        For I = 0 To NUDS.Length - 1
            NUDS(I).MouseUp(X, Y)
        Next
        For I = 0 To TUDS.Length - 1
            TUDS(I).MouseUp(X, Y)
        Next
        For I = 0 To SUDS.Length - 1
            SUDS(I).MouseUp(X, Y)
        Next
        For I = 0 To CheckBoxen.Length - 1
            CheckBoxen(I).MouseUp(X, Y)
        Next
        For I = 0 To Textboxen.Length - 1
            Textboxen(I).MouseUp(X, Y)
        Next
        For I = 0 To DropDownMenues.Length - 1
            DropDownMenues(I).MouseUp(X, Y)
        Next
        Dim Funktion As String = ""
        'Wenn wir ein Einheitenmenue haben klicken wir drauf
        If Not Objektverwalter.EinheitenMenue Is Nothing Then Funktion = Objektverwalter.EinheitenMenue.CheckMouseDown
        'Falls wir einen Befehl haben koennen wir ihn ausfuehren
        If Not Funktion = "" Then
            Return Funktion
        End If

        If IsNothing(Box) = False Then
            Select Case Box.Zustand
                Case ObjektBox.Zustaende.Keiner
                Case ObjektBox.Zustaende.Abrechen
                    Funktion = Box.MouseUp(X, Y)
                Case ObjektBox.Zustaende.NurBefehle
                    Funktion = Box.MouseUp(X, Y)
            End Select
        End If
        If Funktion = "" Then
            Funktion = checkMouseUPKnoepfe(X, Y)
            If Not Funktion = "" Then
                Return Funktion
            Else
                If IsNothing(Taskleiste) = False Then
                    Funktion = Taskleiste.MouseUP(X, Y)
                End If
                If Funktion = "" Then
                    Funktion = CheckUPNuds(X, Y)
                End If
                If Funktion = "" Then
                    Funktion = CheckMouseUpCheckBox(X, Y)
                End If
            End If
        End If
        Return Funktion
    End Function
    Private Function checkMouseUPKnoepfe(ByVal XKoo As Integer, ByVal YKoo As Integer) As String
        For I = 0 To Knoepfe.Length - 1
            Dim Funktion As String = Knoepfe(I).MouseUp(XKoo, YKoo)
            If Not Funktion = "" Then
                Return Funktion
            End If
        Next
        Return ""
    End Function
    Private Function CheckUPNuds(ByVal X As Integer, ByVal Y As Integer) As String
        For I = 0 To NUDS.Length - 1
            NUDS(I).MouseUp(X, Y)
        Next
        Return ""
    End Function
    Private Function CheckMouseUpCheckBox(ByVal X, ByVal Y) As String
        Dim Funktion As String
        For I = 0 To CheckBoxen.Length - 1
            Funktion = CheckBoxen(I).MouseUp(X, Y)
            If Funktion <> "" Then
                Return Funktion
            End If
        Next
        Return ""
    End Function
#End Region
#Region "Mouse Down"
    Public Sub checkMouseDownObjekte(ByVal X As Integer, ByVal Y As Integer)
        If IsNothing(Box) = False Then
            Select Case Box.Zustand
                Case ObjektBox.Zustaende.Keiner
                    MouseDownOhneBox(X, Y)
                Case ObjektBox.Zustaende.Abrechen
                    Box.MouseDown(X, Y)
                    Exit Sub
                Case ObjektBox.Zustaende.NurBefehle
                    Box.MouseDown(X, Y)
                    Exit Sub
            End Select
        Else
            MouseDownOhneBox(X, Y)
        End If

    End Sub
    ''' <summary>
    ''' Ueberprueft ob auf einen Button geklickt wurde
    ''' </summary>
    ''' <param name="XKoo"></param>
    ''' <param name="YKoo"></param>
    ''' <remarks></remarks>
    Private Sub checkMousedownKnoepfe(ByVal XKoo As Integer, ByVal YKoo As Integer)
        For I = 0 To Knoepfe.Length - 1
            Knoepfe(I).MouseDown(XKoo, YKoo)
        Next
    End Sub
    Private Sub MouseDownOhneBox(ByVal X As Integer, ByVal Y As Integer)
        If Objekt2D.HasFocus Then
            For I = 0 To Objekt2D.Objekte.Length - 1
                If Objekt2D.Objekte(I).Focused Then
                    If Objekt2D.Objekte(I).MouseDown(X, Y) Then
                        Exit Sub
                    End If
                End If
            Next
        End If
        For I = 0 To Panels.Length - 1
            Panels(I).MouseDown(X, Y)
        Next
        checkMousedownKnoepfe(X, Y)
        If IsNothing(Taskleiste) = False Then
            Taskleiste.MouseDown(X, Y)
        End If
        For I = 0 To Values.Length - 1
            Values(I).MouseDown(X, Y)
        Next
        For I = 0 To NUDS.Length - 1
            NUDS(I).MouseDown(X, Y)
        Next
        For I = 0 To TUDS.Length - 1
            TUDS(I).MouseDown(X, Y)
        Next
        For I = 0 To SUDS.Length - 1
            SUDS(I).MouseDown(X, Y)
        Next
        For I = 0 To MultiValues.Length - 1
            MultiValues(I).MouseDown(X, Y)
        Next
        For I = 0 To CheckBoxen.Length - 1
            CheckBoxen(I).MouseDown(X, Y)
        Next
        For I = 0 To Textboxen.Length - 1
            Textboxen(I).MouseDown(X, Y)
        Next
        For I = 0 To DropDownMenues.Length - 1
            DropDownMenues(I).MouseDown(X, Y)
        Next
        If Objektverwalter.Spielfeld IsNot Nothing Then
            If Objektverwalter.Spielfeld.Animationen IsNot Nothing Then
                For Each Ani In Objektverwalter.Spielfeld.Animationen
                    Ani.MouseDown(Nothing, New System.Windows.Forms.MouseEventArgs(MouseButtons.Left, 1, X, Y, 0))
                Next
            End If
            If Objektverwalter.Spielfeld.Angriff IsNot Nothing Then
                If Objektverwalter.Spielfeld.Angriff.Kampfani IsNot Nothing Then
                    Objektverwalter.Spielfeld.Angriff.Kampfani.MouseDown(Nothing, New System.Windows.Forms.MouseEventArgs(MouseButtons.Left, 1, X, Y, 0))
                End If
            End If
            If Objektverwalter.Spielfeld.KOInfos IsNot Nothing Then
                Objektverwalter.Spielfeld.KOInfos.MouseDown(X, Y)
            End If
        End If
        If ObjektKODialog.KOTextZeilen IsNot Nothing Then
            ObjektKODialog.KOTextZeilen.MouseDown(Nothing, New System.Windows.Forms.MouseEventArgs(MouseButtons.Left, 1, X, Y, 0))
        End If
    End Sub
#End Region
#Region "Mouse Move"
    Public Sub MouseMoveObjekte(ByVal X As Integer, ByVal Y As Integer)
        If Not Objektverwalter.EinheitenMenue Is Nothing Then
            Objektverwalter.EinheitenMenue.MouseMove(X, Y)
            Exit Sub
        End If
        If Objekt2D.HasFocus Then
            For I = 0 To Objekt2D.Objekte.Length - 1
                If Objekt2D.Objekte(I).Focused Then
                    If Objekt2D.Objekte(I).MouseEnter(X, Y) Then
                        Exit Sub
                    End If
                End If
            Next
        End If
        If IsNothing(Box) = False Then
            Select Case Box.Zustand
                Case ObjektBox.Zustaende.Keiner
                Case ObjektBox.Zustaende.Abrechen
                    Box.MouseMove(X, Y)
                    Exit Sub
                Case ObjektBox.Zustaende.NurBefehle
                    Box.MouseMove(X, Y)
                    Exit Sub
            End Select
        End If

        For I = 0 To Panels.Length - 1
            Panels(I).MouseMove(X, Y)
        Next
        MouseMoveButtons(X, Y)
        If IsNothing(Taskleiste) = False Then
            Taskleiste.MouseMove(X, Y)
        End If
        For I = 0 To Values.Length - 1
            Values(I).MouseMove(X, Y)
        Next
        For I = 0 To MultiValues.Length - 1
            MultiValues(I).MouseEnter(X, Y)
        Next
        For I = 0 To Textboxen.Length - 1
            Textboxen(I).MouseEnter(X, Y)
        Next
        For I = 0 To DropDownMenues.Length - 1
            If DropDownMenues(I) IsNot Nothing Then
                DropDownMenues(I).MouseEnter(X, Y)
            End If
        Next
    End Sub
    Private Sub MouseMoveButtons(ByVal XKoo As Integer, ByVal YKoo As Integer)
        For I = 0 To Knoepfe.Length - 1
            If Not Knoepfe(I) Is Nothing Then
                Knoepfe(I).MouseEnter(XKoo, YKoo)
            End If
        Next
    End Sub
#End Region
#Region "Key Input"
    Public Function KeyDownObjekte(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) As Boolean
        For I = 0 To Textboxen.Length - 1
            If Textboxen(I).Keydown(sender, e) Then Return True
        Next
        For I = 0 To NUDS.Length - 1
            If NUDS(I).Keydown(sender, e) Then Return True
        Next
        For I = 0 To TUDS.Length - 1
            If TUDS(I).Keydown(sender, e) Then Return True
        Next
        If Objektverwalter.Spielfeld IsNot Nothing Then
            If Objektverwalter.Spielfeld.Animationen IsNot Nothing Then
                For Each Ani In Objektverwalter.Spielfeld.Animationen
                    Ani.KeyDown(sender, e)
                Next
            End If
            If Objektverwalter.Spielfeld.Angriff IsNot Nothing Then
                If Objektverwalter.Spielfeld.Angriff.Kampfani IsNot Nothing Then
                    Objektverwalter.Spielfeld.Angriff.Kampfani.KeyDown(sender, e)
                End If
            End If
            If Objektverwalter.Spielfeld.KOInfos IsNot Nothing Then
                Objektverwalter.Spielfeld.KOInfos.KeyDown(sender, e)
            End If
        End If
        If ObjektKODialog.KOTextZeilen IsNot Nothing Then
            ObjektKODialog.KOTextZeilen.KeyDown(sender, e)
        End If
        Return False
    End Function
#End Region
#Region "Mouse Wheel"
    Public Function MouseWheelObjekte(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) As Boolean
        If Objektverwalter.Spielfeld IsNot Nothing Then
            If Objektverwalter.Spielfeld.KOInfos IsNot Nothing Then
                Objektverwalter.Spielfeld.KOInfos.MouseWheel(sender, e)
                Return True
            End If
        End If
        Return False
    End Function
#End Region
    Public MustOverride Sub SprachEingabe(ByVal Eingabe As String)
#End Region
#Region "Objekte erschaffen"
    Public Sub NeuButton(ByVal XKoomin As Integer, ByVal YKoomin As Integer, ByVal Bildpfad As String, ByVal Funktion As String, ByVal Fixed As PointF, Optional ByVal XBreite As Integer = Nothing, Optional ByVal YBreite As Integer = Nothing, Optional ByVal Zoom As Boolean = False, Optional ByVal Handler As ObjektPanel = Nothing)
        Dim Bild As Bitmap = Image.FromFile(Bildpfad)
        If XBreite = Nothing Then
            XBreite = Bild.Width / 2
        End If
        If YBreite = Nothing Then
            YBreite = Bild.Height
        End If
        KnoepfeLocker.Lock()
        Array.Resize(Knoepfe, Knoepfe.Length + 1)
        Knoepfe(Knoepfe.Length - 1) = New ObjektButton(XKoomin, YKoomin, Bildpfad, Funktion, Fixed, Handler)
        KnoepfeLocker.Unlock()
    End Sub
    ''' <summary>
    ''' Loescht ALLE Buttons die als Text, die angezeigte Funktion zeigen (Gross-/Kleinschreibung wird nicht beruecksichtigt)
    ''' </summary>
    ''' <param name="Funktion"></param>
    ''' <remarks></remarks>
    Public Sub LoeschenButton(ByVal Funktion As String)
        KnoepfeLocker.Lock()
        Dim i As Integer = 0
        While i < Knoepfe.Length
            If Knoepfe(i) IsNot Nothing Then
                If Knoepfe(i).Tag.ToLower = Funktion.ToLower Then
                    Knoepfe(i) = Knoepfe(Knoepfe.Length - 1)
                    Array.Resize(Knoepfe, Knoepfe.Length - 1)
                Else
                    i += 1
                End If
            End If
        End While
        KnoepfeLocker.Unlock()
    End Sub
    Public Sub LoeschenPanel(ByVal I As Integer)
        Panels(I).RemoveHandles()
        Panels(I) = Panels(Panels.Length - 1)
        Array.Resize(Panels, Panels.Length - 1)
    End Sub
    ''' <summary>
    ''' Alle Knoepfe werden ohne ausnahme geloescht.
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub ResetButton()
        For I = 0 To Knoepfe.Length - 1
            Objekt2D.RemoveObjekt(Knoepfe(I))
        Next
        Array.Resize(Knoepfe, 0)
    End Sub
    Public Sub neuNUD(ByVal Startvalue As Integer, ByVal Min As Integer, ByVal Max As Integer, ByVal P As Point, ByVal Bild As String, ByVal Aenderung As Integer, ByVal Fixed As PointF, Optional ByVal Handler As ObjektPanel = Nothing, Optional ByVal Infinite As Integer = -1)
        Array.Resize(NUDS, NUDS.Length + 1)
        NUDS(NUDS.Length - 1) = New ObjektNumericUpDown(Startvalue, Min, Max, Bild, P, Aenderung, Fixed, Infinite, Handler)
    End Sub
    Public Sub neuTUD(ByVal Startvalue As Long, ByVal Min As Long, ByVal Max As Long, ByVal P As Point, ByVal Bild As String, ByVal Aenderung As Long, ByVal Fixed As PointF, Optional ByVal Handler As ObjektPanel = Nothing, Optional ByVal Infinite As Integer = -1)
        Array.Resize(TUDS, TUDS.Length + 1)
        TUDS(TUDS.Length - 1) = New ObjektTimeUpDown(Startvalue, Min, Max, Bild, P, Aenderung, Fixed, Infinite, Handler)
    End Sub
    Public Sub NeuCheckBoxen(ByVal XKoomin As Integer, ByVal YKoomin As Integer, ByVal Bildpfad As String, ByVal Fixed As PointF, Optional ByVal Checked As Boolean = True, Optional ByVal Handler As ObjektPanel = Nothing)
        CheckBoxenLocker.Lock()
        Array.Resize(CheckBoxen, CheckBoxen.Length + 1)
        CheckBoxen(CheckBoxen.Length - 1) = New ObjektCheckBox(New Point(XKoomin, YKoomin), Bildpfad, Fixed, Checked, Handler)
        CheckBoxenLocker.Unlock()
    End Sub
    Public Function ExistiertButton(ByVal Funktion As String) As Boolean
        For I = 0 To Knoepfe.Length - 1
            If Knoepfe(I).Tag.ToLower = Funktion.ToLower Then Return True
        Next
        Return False
    End Function
    Public Sub NeuStringUpDown(ByVal XKoomin As Integer, ByVal YKoomin As Integer, ByVal Bildpfad As String, ByVal Funktion As String(), ByVal Startvalue As Integer, ByVal Fixed As PointF, Optional ByVal Handler As ObjektPanel = Nothing)
        SUDSLocker.Lock()
        Array.Resize(SUDS, SUDS.Length + 1)
        SUDS(SUDS.Length - 1) = New ObjektStringUpDown(Startvalue, Funktion, Bildpfad, New Point(XKoomin, YKoomin), Fixed, Handler)
        SUDSLocker.Unlock()
    End Sub
    Public Sub NeuLabel(ByVal XKoomin As Integer, ByVal YKoomin As Integer, ByVal Text As String(), ByVal Fixed As PointF, Optional ByVal Handler As ObjektPanel = Nothing)
        LabelsLocker.Lock()
        Array.Resize(Labels, Labels.Length + 1)
        Labels(Labels.Length - 1) = New ObjektLabel(XKoomin, YKoomin, DataSettings.Resourcenpfad + "Objects\Transparent.png", Text, New Point(0, 0), 10, 0, Fixed, Handler)
        LabelsLocker.Unlock()
    End Sub
    Public Sub NeuTextFeld(ByVal X As Integer, ByVal Y As Integer, ByVal Breite As Integer, ByVal Fixed As PointF, Optional ByVal Handler As ObjektPanel = Nothing)
        Array.Resize(Textboxen, Textboxen.Length + 1)
        Textboxen(Textboxen.Length - 1) = New ObjektTextbox(X, Y, Breite, Fixed, Handler)
    End Sub
    Public Sub NeuDropDownMenue(ByVal X As Integer, ByVal Y As Integer, ByVal Items() As String, ByVal Fixed As PointF, Optional ByVal Handler As ObjektPanel = Nothing)
        Array.Resize(DropDownMenues, DropDownMenues.Length + 1)
        DropDownMenues(DropDownMenues.Length - 1) = New ObjektDropDownMenue(X, Y, Items, Fixed, , Handler)
    End Sub
    Public Sub NeuDropDownMenue(ByVal X As Integer, ByVal Y As Integer, ByVal Items() As Color, ByVal Fixed As PointF)
        Array.Resize(DropDownMenues, DropDownMenues.Length + 1)
        DropDownMenues(DropDownMenues.Length - 1) = New ObjektDropDownMenue(X, Y, Items, Fixed)
    End Sub
    Public Sub NeuPanel(ByVal Panel As ObjektPanel)
        Array.Resize(Panels, Panels.Length + 1)
        Panels(Panels.Length - 1) = Panel
    End Sub
#End Region
    Public MustOverride Sub Malen()
    Public MustOverride Sub SetMausBild()
    Public MustOverride Sub Frame()
    Public Overridable Sub Reset()

    End Sub
    Protected Sub ObjekteMalen()
        For I = 0 To Panels.Length - 1
            Panels(I).Malen()
        Next
        KnoepfeLocker.Lock()
        For I As Integer = 0 To Knoepfe.Length - 1
            If Not Knoepfe(I) Is Nothing Then
                Knoepfe(I).Malen()
            End If
        Next
        KnoepfeLocker.Unlock()
        If IsNothing(Taskleiste) = False Then
            Taskleiste.Malen()
        End If
        For I = 0 To NUDS.Length - 1
            If Not NUDS(I) Is Nothing Then
                NUDS(I).Malen()
            End If
        Next
        For I = 0 To SUDS.Length - 1
            If Not SUDS(I) Is Nothing Then
                SUDS(I).Malen()
            End If
        Next
        For I = 0 To Values.Length - 1
            If Not Values(I) Is Nothing Then
                Values(I).Malen()
            End If
        Next
        For I = 0 To MultiValues.Length - 1
            If Not MultiValues(I) Is Nothing Then
                MultiValues(I).Malen()
            End If
        Next
        For I = 0 To CheckBoxen.Length - 1
            If Not CheckBoxen(I) Is Nothing Then
                CheckBoxen(I).Malen()
            End If
        Next
        For I = 0 To Labels.Length - 1
            If Not Labels(I) Is Nothing Then
                Labels(I).Malen()
            End If
        Next
        For I = 0 To TUDS.Length - 1
            If Not TUDS(I) Is Nothing Then
                TUDS(I).Malen()
            End If
        Next
        'Noch ein paar Sachen malen.
        Dim FocusObjekt As Integer = -1
        For I = 0 To Objekt2D.Objekte.Length - 1
            If Not Objekt2D.Objekte(I) Is Nothing Then
                If Objekt2D.Objekte(I).Focused Then
                    FocusObjekt = I
                Else
                    If TypeOf Objekt2D.Objekte(I) Is ObjektDropDownMenue Then
                        Objekt2D.Objekte(I).Malen()
                    ElseIf TypeOf Objekt2D.Objekte(I) Is ObjektTextbox Then
                        Objekt2D.Objekte(I).Malen()
                    End If
                End If
            End If
        Next
        If FocusObjekt >= 0 Then
            Objekt2D.Objekte(FocusObjekt).Malen()
        End If
        If IsNothing(Box) = False Then
            Box.Malen()
        End If
    End Sub

    ' Public MustOverride Sub ChangeWindowSize(ByVal PosChange As Point)
    Public MustOverride Sub ChangeWindowSize(ByVal PosChange As Point)

    ''' <summary>
    ''' Alle Objekte werden etwas verschoben.
    ''' </summary>
    ''' <param name="PosChange"></param>
    ''' <remarks></remarks>
    Protected Sub ChangeWindowSizeObjekte(ByVal PosChange As Point)
        For Each P In Panels
            P.ChangeWindowSize(PosChange)
        Next
        For Each Knopf In Knoepfe
            Knopf.ChangeWindowSize(PosChange)
        Next
        For Each NUD In NUDS
            NUD.ChangeWindowSize(PosChange)
        Next
        For Each TUD In TUDS
            TUD.ChangeWindowSize(PosChange)
        Next
        For Each SUD In SUDS
            SUD.ChangeWindowSize(PosChange)
        Next
        For Each Value In Values
            Value.ChangeWindowSize(PosChange)
        Next
        For Each Label In Labels
            Label.ChangeWindowSize(PosChange)
        Next
        For Each DropDownMenue In DropDownMenues
            DropDownMenue.ChangeWindowSize(PosChange)
        Next
        For Each CheckBox In CheckBoxen
            CheckBox.ChangeWindowSize(PosChange)
        Next
        For Each Textbox In Textboxen
            Textbox.ChangeWindowSize(PosChange)
        Next
        For Each MultiValue In MultiValues
            MultiValue.ChangeWindowSize(PosChange)
        Next
        If Not Box Is Nothing Then
            Box.ChangeWindowSize(PosChange)
        End If
    End Sub
End Class
